package logic;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPasswordField;

import data.User;
import ui.GlobalLogin;
import ui.UserDeposit;
import ui.UserTransfer;
import ui.UserWithdraw;

public class ACListUser implements ActionListener {
	ui.UserPanel UserPanel;
	ui.UserUI userui;
	logic.ACMethodUser ACMethodUser;
	ui.UserCenterPanel usercenterPanel;
	ui.GlobalLogoutPanel logoutpanel;
	GlobalLogin globallogin;
	UserDeposit userDeposit;
	User currentUser;
	UserWithdraw userWithdraw;
	UserTransfer userTransfer;
	

	public ACListUser(ui.UserPanel UserPanel, ui.UserUI Userui, ui.UserCenterPanel usercenterPanel) {
		this.UserPanel = UserPanel;
		this.userui =Userui;
		this.usercenterPanel = usercenterPanel;
		this.userDeposit = usercenterPanel.userDeposit;
		this.userWithdraw = usercenterPanel.userWithdraw;
		this.userTransfer = usercenterPanel.userTransfer;
		
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		logic.ACMethodUser b = new ACMethodUser(userui, usercenterPanel);
		String ac = e.getActionCommand();
		if (ac.equals("Deposit")) {
			
			b.DepositButton();
		} else if (ac.equals("Withdraw")) {
			b.WithdrawButton();
		} else if (ac.equals("Transfer")) {
			b.TransferButton();
		} else if (ac.equals("Home")) {
			b.HomeButton();

		}
		else if (ac.equals("DepositConfirm")){
			b.deposit();
		}
		
		else if (ac.equals("WithdrawConfirm")){
			b.withdraw();
		}
		
		else if (ac.equals("TransferConfirm")){
			b.transfer();
		}
			
	
	
}

	public  User getCurrentUser() {
		return currentUser;
	}

	public void setCurrentUser(User currentUser) {
		this.currentUser = currentUser;
	}
	}